package com.workcell.workdata.xthings.api.feign;

import com.workcell.workdata.common.core.constant.SecurityConstants;
import com.workcell.workdata.common.core.util.R;
import com.workcell.workdata.xthings.dto.fd.FormTableDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.Map;

/**
 * @Author guogyu
 * @Date 2023/3/3 16:53
 * @Description
 */
@FeignClient(contextId = "remoteFormDataService", value = "form-data-biz")
public interface RemoteFormDataService {

    @GetMapping(value = "/xts/getAppData/{name}/{tenantId}/{userId}")
    R getAppData(@PathVariable("name") String name, @PathVariable("tenantId") Long tenantId, @PathVariable("userId") Long userId);

    @GetMapping(value = "/xts/getAppDataByTemplate/{name}/{tenantId}/{userId}")
    R getAppDataByTemplate(@PathVariable("name") String name, @PathVariable("tenantId") Long tenantId, @PathVariable("userId") Long userId);

    @PostMapping(value = "/xthings/formInstance/xiaosiMap/abnormalList")
    R abnormalList(@RequestBody Map<String, Object> dto, @RequestHeader(SecurityConstants.FROM) String from);

    @GetMapping("/xthings/formInstance/xiaosiMap/areaCount/{templateId}")
    R areaCount(@PathVariable("templateId") Long templateId, @RequestHeader(SecurityConstants.FROM) String from);

    @PostMapping("/formInstance")
    R formInstanceSave(Map<String, Object> map);

    @PostMapping("/formInstance/page")
    R formInstancePage(FormTableDTO formTableDTO);
}
